create or replace view vac_app_calendar_templates_4_1 as
with tc as
(
select
 workspace,
 workspace_display_name,
 application_id,
 application_name,
 template_name,
 last_updated_by,
 last_updated_on,
 theme_number,
 theme_class,
 translatable,
 is_subscribed,
 subscribed_from,
 month_title_format,
 day_of_week_format,
 month_open_format,
 month_close_format,
 day_title_format,
 day_open_format,
 day_close_format,
 today_open_format,
 weekend_title_format,
 weekend_open_format,
 weekend_close_format,
 nonday_title_format,
 nonday_open_format,
 nonday_close_format,
 week_title_format,
 week_open_format,
 week_close_format,
 daily_title_format,
 daily_open_format,
 daily_close_format,
 weekly_title_format,
 weekly_day_of_week_format,
 weekly_month_open_format,
 weekly_month_close_format,
 weekly_day_title_format,
 weekly_day_open_format,
 weekly_day_close_format,
 weekly_today_open_format,
 weekly_weekend_title_format,
 weekly_weekend_open_format,
 weekly_weekend_close_format,
 weekly_time_open_format,
 weekly_time_close_format,
 weekly_time_title_format,
 weekly_hour_open_format,
 weekly_hour_close_format,
 daily_day_of_week_format,
 daily_month_title_format,
 daily_month_open_format,
 daily_month_close_format,
 daily_day_title_format,
 daily_day_open_format,
 daily_day_close_format,
 daily_today_open_format,
 daily_time_open_format,
 daily_time_close_format,
 daily_time_title_format,
 daily_hour_open_format,
 daily_hour_close_format,
 component_comment
from APEX_APPLICATION_TEMP_CALENDAR t
)
select
 workspace,
 workspace_display_name,
 application_id,
 application_name,
 template_name,
 last_updated_by,
 last_updated_on,
 theme_number,
 u_value,
 u_name,
 'APEX_APPLICATION_TEMP_CALENDAR' SRC_VIEW_NAME
from tc
 UNPIVOT INCLUDE NULLS
  (u_value FOR u_name IN
   (
     theme_class,
     translatable,
     is_subscribed,
     subscribed_from,
     month_title_format,
     day_of_week_format,
     month_open_format,
     month_close_format,
     day_title_format,
     day_open_format,
     day_close_format,
     today_open_format,
     weekend_title_format,
     weekend_open_format,
     weekend_close_format,
     nonday_title_format,
     nonday_open_format,
     nonday_close_format,
     week_title_format,
     week_open_format,
     week_close_format,
     daily_title_format,
     daily_open_format,
     daily_close_format,
     weekly_title_format,
     weekly_day_of_week_format,
     weekly_month_open_format,
     weekly_month_close_format,
     weekly_day_title_format,
     weekly_day_open_format,
     weekly_day_close_format,
     weekly_today_open_format,
     weekly_weekend_title_format,
     weekly_weekend_open_format,
     weekly_weekend_close_format,
     weekly_time_open_format,
     weekly_time_close_format,
     weekly_time_title_format,
     weekly_hour_open_format,
     weekly_hour_close_format,
     daily_day_of_week_format,
     daily_month_title_format,
     daily_month_open_format,
     daily_month_close_format,
     daily_day_title_format,
     daily_day_open_format,
     daily_day_close_format,
     daily_today_open_format,
     daily_time_open_format,
     daily_time_close_format,
     daily_time_title_format,
     daily_hour_open_format,
     daily_hour_close_format,
     component_comment
   )
);

